package inabit.inabitcompiler.productions.rule.expressions.arithmetic;

import inabit.compiler.parser.grammar.NonTerminal;
import inabit.compiler.parser.grammar.Production;
import inabit.compiler.parser.grammar.Symbol;
import inabit.compiler.parser.grammar.Terminal;
import inabit.inabitcompiler.lexical.InabitTokenClass;
import inabit.inabitcompiler.parser.InabitSemanticAction;

/**Z -> (A)*/
/**@author Rafael Rocha*/
public class Z_Rule4 extends Production{

	private NonTerminal A;
	public Z_Rule4() {
		super("Z");
	}

	@Override
	protected Symbol[] production(final NonTerminal nonTerminal) {
		A = new NonTerminal("A");
		Symbol[] symbols = {
			new Terminal(InabitTokenClass.OPEN_PARENTHESIS),
			A,
			new Terminal(InabitTokenClass.CLOSE_PARENTHESIS),
			new InabitSemanticAction(nonTerminal) {
				public void execute() {
					nonTerminal.code = A.code;
				}
			}
		};
		return symbols;
	}

}
